//
//  QianYueViewController.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/3/13.
//  Copyright © 2017年 金橙云. All rights reserved.
//

#import "QianYueViewController.h"

#import "QianYueCell.h"

#import "GouDetailsViewController.h"
@interface QianYueViewController ()<UITableViewDataSource,UITableViewDelegate>
{
     NSMutableArray *_yueArr;
}
@property(nonatomic,strong)UITableView *tabView;
@end

@implementation QianYueViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"待签约";
    _yueArr = [NSMutableArray arrayWithCapacity:0];
    _yueArr = [_yueDic objectForKey:@"data"];
    _tabView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, B_WIDTH, B_HEIGHT) style:UITableViewStylePlain];
    _tabView.delegate = self;
    _tabView.dataSource = self;
    _tabView.rowHeight = 90;
    _tabView.backgroundColor = BgColor;
    _tabView.separatorStyle = UITableViewCellSelectionStyleNone;//去掉cell的分割线
    [self.view addSubview:_tabView];

}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_yueStr intValue];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellID = @"Cell";
    QianYueCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil)
    {
        cell = [[QianYueCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    if ([cell isKindOfClass:[QianYueCell class]])
    {
        if (_yueArr.count != 0)
        {
            NSDictionary *dict = [_yueArr objectAtIndex:indexPath.row];
            
            [(QianYueCell *)cell setUpQianYUeCellWithName:dict[@"rengou_name"] withGouDate:dict[@"rengou_time"] withGouHouse:dict[@"fy_name"] withPay:dict[@"pay_way"] withShouState:dict[@"sf_status"] withDaiPay:dict[@"ptf_status"] withPhone:dict[@"rengou_phone"]];
            
        }
    }
     [cell setSelectionStyle:UITableViewCellSelectionStyleNone];//取消点击
    return cell;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    GouDetailsViewController *gouDetailsVC = [[GouDetailsViewController alloc] init];
    gouDetailsVC.idStr = [[_yueArr objectAtIndex:indexPath.row] objectForKey:@"id"];
    
    [self.navigationController pushViewController:gouDetailsVC animated:NO];
    
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
